//
//  UIView+Extension.swift
//  SinaWeibo
//
//  Created by apple on 15/11/17.
//  Copyright © 2015年 apple. All rights reserved.
//

import UIKit

extension UIView {
    
    func NavController() ->UINavigationController? {
        
        
        //遍历响应者链条
        //获取当前的视图对象的下一个响应者
        var next = self.nextResponder()
        
        repeat {
        
        if next is UINavigationController {
        
           return next as? UINavigationController
        }
         
            next = next?.nextResponder()
            
    } while (next != nil)
        
        //如果一直找不到 就返回空
        return nil
    }
}
